#pragma once
#include "Dispatcher.h"
#include <poll.h>

class PollDispatcher : public Dispatcher
{
public:
    PollDispatcher(EventLoop *evLoop);
    ~PollDispatcher();
    // 添加
    int32_t add() override;
    // 删除
    int32_t remove() override;
    // 修改
    int32_t modify() override;
    // 事件检测 2s
    int32_t dispatch(int timeout = 2) override;

private:
    int32_t m_maxFd;
    struct pollfd *m_fds;
    const int m_maxNode = 1024;
};
